import request from "@/request";

export default {
  // 获取元素信息列表
  getList(params) {
    return request({
      url: "/element/provide/list",
      method: "get",
      params,
    });
  },
  getDetail(id) {
    return request({
      url: `/element/provide/${id}`,
      method: "get",
    });
  },
  // 获取元素信息列表
  getCustomerList(params) {
    return request({
      url: "/customer/element/list",
      method: "get",
      params,
    });
  },
  getCustomerDetail(id) {
    return request({
      url: `/customer/element/${id}`,
      method: "get",
    });
  },
  getElementFileList(params) {
    return request({
      url: "/element/file/list",
      method: "get",
      params,
    });
  },
  createElement(data) {
    return request({
      url: "/element/provide",
      method: "post",
      data,
    });
  },
  updateElement(data) {
    return request({
      url: "/element/provide",
      method: "put",
      data,
    });
  },
  addFile(data) {
    return request({
      url: "/element/file",
      method: "post",
      data,
    });
  },
  updateFile(data) {
    return request({
      url: "/element/file",
      method: "put",
      data,
    });
  },
  removeFile(params) {
    return request({
      url: "/element/file/delete",
      method: "delete",
      params,
    });
  },
  getFileDetail(id) {
    return request({
      url: `/element/file/${id}`,
      method: "get",
    });
  },
  updateFileDownloadNum(id) {
    return request({
      url: "/element/file/download",
      method: "get",
      params: { id },
    });
  },

  toggleStatus(data) {
    return request({
      url: "/element/provide/updateStatus",
      method: "put",
      data,
    });
  },
  toggleFileStatus(data) {
    return request({
      url: "/element/file/updateStatus",
      method: "put",
      data,
    });
  },
};
